#include <stdio.h>

int turn(int n, int k, int *get) {
	int a = n;
	if (n >= k) {
		(*get)++;
		n = n - k + 1;
		turn(n, k, get);
	}
	return (a + *get);
}

int main() {
	int n, k;
	int total;
	int get = 0;
	scanf("%d %d", &n, &k);
	total = turn(n, k, &get);
	printf("%d", total);
	return 0;
}